﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="ebook">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="title" type="xs:string" />
                <xs:element name="sub-titles">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" name="sub-title" type="xs:string" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="description" type="xs:string" nillable="true" />
                <xs:element name="authors">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" name="author">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute name="type" type="xs:string" use="optional" default="Primary" />
                                            <xs:attribute name="description" type="xs:string" use="optional" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="categories">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" name="category" type="xs:string" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="tags">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" name="tag" type="xs:string" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="links">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" name="link">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute name="type" type="xs:string" use="optional" default="Other" />
                                            <xs:attribute name="description" type="xs:string" use="optional" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="images">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element maxOccurs="unbounded" name="image">
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string">
                                            <xs:attribute name="type" type="xs:string" use="optional" default="Front" />
                                            <xs:attribute name="height" type="xs:int" use="optional" />
                                            <xs:attribute name="width" type="xs:int" use="optional" />
                                        </xs:extension>
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="format" type="xs:string" use="required" />
            <xs:attribute name="rating" type="xs:int" use="optional" default="3" />
            <xs:attribute name="isbn-10" type="xs:string" use="optional" />
            <xs:attribute name="isbn-13" type="xs:string" use="optional" />
            <xs:attribute name="publisher" type="xs:string" use="optional" />
            <xs:attribute name="publish-date" type="xs:date" use="optional" />
            <xs:attribute name="language" type="xs:string" use="optional" default="en-us" />
            <xs:attribute name="page-count" type="xs:int" use="optional" />
        </xs:complexType>
    </xs:element>
</xs:schema>